<?php

namespace App\Entity\Common;

use ApiPlatform\Core\Annotation\ApiResource;
use App\Base\Annotation\Common;
use App\Entity\ComCategory;
use App\Repository\Common\BannerRepository;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ApiResource()
 * @ORM\Entity(repositoryClass=BannerRepository::class)
 */
class Banner
{
    /**
     * @Common(cnName="#",listType="text",editType="text")
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @Common(cnName="位置",listType="text",editType="text")
     * @ORM\ManyToOne(targetEntity=ComCategory::class)
     */
    private $position;

    /**
     * @Common(cnName="图片",listType="pic",editType="pic",width="300")
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $pic;

    /**
     * @Common(cnName="图片",listType="text",editType="pic")
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $url;

    /**
     * @Common(cnName="顺序",listType="text",editType="text")
     * @ORM\Column(type="integer", nullable=true)
     */
    private $sort;

    /**
     * @Common(cnName="参数",listType="text",editType="text")
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $param;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getPosition(): ?ComCategory
    {
        return $this->position;
    }

    public function setPosition(?ComCategory $position): self
    {
        $this->position = $position;

        return $this;
    }

    public function getPic(): ?string
    {
        return $this->pic;
    }

    public function setPic(?string $pic): self
    {
        $this->pic = $pic;

        return $this;
    }

    public function getUrl(): ?string
    {
        return $this->url;
    }

    public function setUrl(?string $url): self
    {
        $this->url = $url;

        return $this;
    }

    public function getSort(): ?int
    {
        return $this->sort;
    }

    public function setSort(?int $sort): self
    {
        $this->sort = $sort;

        return $this;
    }

    public function getParam(): ?string
    {
        return $this->param;
    }

    public function setParam(?string $param): self
    {
        $this->param = $param;

        return $this;
    }
}
